#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define F first
#define S second
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
const int N=2000;
int a[N];
void solve()
{
	int n;
	cin>>n;
	for(int i=1;i<=2*n;i++) cin>>a[i];
	sort(a+1,a+1+2*n);
	ll cnt=0;
	cnt= a[n]-a[1] + a[2*n]-a[n+1];
	cout<<cnt<<'\n';
	for(int i=1;i<=n;i++)
	{
		cout<<a[i]<<' '<<a[i+n]<<'\n';
	}
}
int main()
{
	IOS;
	int T=1;
	cin>>T;

	while(T--)
	{
		solve();
	}

	return 0;
}

